interface IuiHeaderScope extends ng.IScope {
  //app:any,
  islogin:any
  /**
   * 用户名
   */
  realName:string;
  /**用户组 */
  userGroup:string;
  /**野狗value值 */
  Wvalue:number;
  /**下载状态 */
  Tstate:string;
  /**失败状态 */
  showWarning:boolean;
  /**进度值 */
  dynamic:number;
  /**缓存中 */

  
}

class uiHeader implements ng.IDirective {
  constructor() { }
  static instance() : ng.IDirective { return new uiHeader; }
  templateUrl: string = './src/directives/ui-header.html';
  restrict: string = 'EA';
  link($scope : IuiHeaderScope, elements : ng.IAugmentedJQuery, attrs : ng.IAttributes) {
    /**登录背景 */
    $scope.islogin=false;
    /**dropdown取消默认点击隐藏 */
    $(".dropdown-menu").click(function (e) {
      e.preventDefault();
      e.stopPropagation();
      return false;
  });
  //console.log($(".fa-download").parent('button'));

  
  function isSmartDevice($window) {
            // Adapted from http://www.detectmobilebrowsers.com
            var ua = $window['navigator']['userAgent'] || $window['navigator']['vendor'] || $window['opera'];
            // Checks for iOs, Android, Blackberry, Opera Mini, and Windows mobile devices
            return (/iPhone|iPod|iPad|Silk|Android|BlackBerry|Opera Mini|IEMobile/).test(ua);
        };

      let loginData = JSON.parse(window.localStorage.getItem("loginData"));
      if(loginData){
          $scope.realName = loginData.realName;/**真实姓名 */
           $scope.userGroup = loginData.userGroup;/**用户组 */
      }

     
  } 
}

angular.module('tms').directive('uiHeader', uiHeader.instance);